Skip to content

Add export, blocklist, tenant budgets, Responses API, and Grafana dashboard#9

Merged
DanialBeg merged 4 commits intomainfrom
feat/roadmap-quick-wins
Mar 17, 2026
Merged

Add export, blocklist, tenant budgets, Responses API, and Grafana dashboard#9
DanialBeg merged 4 commits intomainfrom
feat/roadmap-quick-wins

Conversation

@DanialBeg
Copy link
Contributor

Summary

  • CSV/JSON export: New agentledger export CLI command and GET /api/dashboard/export REST endpoint with --format csv/json, --last, --by, and --tenant filters
  • API key blocklist: Glob-pattern blocklist with 10s TTL cache, admin CRUD endpoints (GET/POST/DELETE /api/admin/api-keys/block), returns 403 for blocked keys
  • Per-tenant budgets: Budget rules now support tenant_id field; enforcement checks both per-key and per-tenant spend, stricter result wins
  • OpenAI Responses API: Full support for /v1/responses endpoint — request parsing (max_output_tokens), response parsing (input_tokens/output_tokens), and response.completed SSE stream events
  • Grafana dashboard: Production-ready Grafana 10.x JSON template with 10 panels across 4 rows (cost, tokens, latency, budget, agents, rate limits)

Test plan

  • All existing tests pass (go test -race ./...)
  • New Responses API tests: request parsing, response parsing, stream chunks, backward compat
  • Budget tests updated for new tenant parameter
  • Proxy tests updated for blocklist parameter
  • Lint clean (golangci-lint run)
  • Manual: agentledger export --format csv --last 24h outputs valid CSV
  • Manual: curl /api/dashboard/export?format=json returns JSON array
  • Manual: POST blocked key pattern, verify 403 on matching requests
  • Manual: Import deploy/grafana/agentledger.json into Grafana, verify panels load

…sponses API, and Grafana dashboard

- CLI `agentledger export` and REST `/api/dashboard/export` for CSV/JSON cost export
- API key blocklist with glob patterns, TTL cache, and admin CRUD endpoints
- Per-tenant budget enforcement (tenant-scoped spend lookups, stricter result wins)
- OpenAI Responses API (`/v1/responses`) request/response/stream parsing
- Grafana 10.x dashboard template with 10 panels across 4 rows
- Example config updates for tenant budget rules
@DanialBeg DanialBeg self-assigned this Mar 17, 2026
@DanialBeg DanialBeg added the enhancement New feature or request label Mar 17, 2026
@DanialBeg DanialBeg requested a review from ZubairQazi March 17, 2026 01:43
… fixes

- Add provider donut chart (Chart.js doughnut) with cost breakdown
- Add most expensive requests table with /api/dashboard/expensive endpoint
- Add error breakdown panel with /api/dashboard/stats endpoint
- Add avg cost/request and error rate summary cards
- Set Chart.js global default color for dark theme compatibility
- Add QueryRecentExpensive and QueryErrorStats to Ledger interface
- Implement new queries for SQLite and Postgres backends
- Redesign dashboard layout with 2-column grid panels
- Auto-select chart interval (hourly/daily/area) based on time range
- Update all test mocks for new Ledger interface methods
- Add 30min and 1hr options to timeseries dropdown
- Add minute-level bucketing to SQLite and Postgres backends
- Support fractional hours in timeseries handler
- Switch all time ranges to line/area chart (no more bar charts)
- Auto-select interval: minute for ≤6h, hourly for ≤24h, daily for >24h
@DanialBeg DanialBeg merged commit 392938b into main Mar 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant